<div th:fragment="left">

	<script type="text/javascript" th:inline="javascript">
	var identityFlg = /*[[${identityFlg}]]*/;
	var ups
	if(identityFlg==1){
		ups = [{id:1, parentId:0,name:"首页", menu:1,url:"/v2/index/index"},
	           {id:2, parentId:0,name:"比赛管理", menu:1,url:""},
		           {id:3, parentId:2,name:"比赛列表", menu:1,url:"/v2/evaluate/list"},
		           {id:33, parentId:2,name:"推荐比赛",url:"/v2/evaluate/ref"},
			           {id:4, parentId:3,name:"比赛详情", menu:0,url:"/org/evaluate/info"},
				           {id:5, parentId:4,name:"比赛阶段", menu:0,url:"/org/evaluate/detail/info"},
				          		{id:6, parentId:5,name:"比赛晋级", menu:0,url:"/org/evaluate/detail/jinji/info"},
				          		{id:7, parentId:5,name:"比赛报名", menu:0,url:"/org/evaluate/detail/baoming/info"},
				          		{id:8, parentId:5,name:"比赛报名", menu:0,url:"/org/evaluate/detail/caiwu/info"},
				{id:9, parentId:0,name:"账户管理", menu:1,url:""},
					{id:11, parentId:9,name:"修改密码", menu:1,url:"/org/acc/pwd"},
				    {id:14, parentId:9,name:"财务管理", menu:1,url:"/org/acc/finance"},
				    {id:18, parentId:0,name:"新闻公告",url:""},
					   {id:19, parentId:18,name:"文章",url:"/v2/shop/article"},
					   {id:110, parentId:18,name:"公告",url:"/v2/shop/notice"},
					   {id:111, parentId:18,name:"照片墙",url:"/v2/shop/zpq"},
					   {id:112, parentId:18,name:"外链",url:"/v2/shop/new"},
					   {id:12, parentId:9,name:"机构详情", menu:1,url:"/org/acc/orgdetails"},
					   //{id:91, parentId:9,name:"子账号",url:"/v2/acc/son"},
					   
	           ];
	}else{
		ups = [{id:1, parentId:0,name:"首页", menu:1,url:"/v2/index/index"},
	           {id:2, parentId:0,name:"比赛管理", menu:1,url:""},
		           {id:3, parentId:2,name:"比赛列表", menu:1,url:"/v2/evaluate/list"},
		           {id:33, parentId:2,name:"推荐比赛",url:"/v2/evaluate/ref"},
			           {id:4, parentId:3,name:"比赛详情", menu:0,url:"/org/evaluate/info"},
				           {id:5, parentId:4,name:"比赛阶段", menu:0,url:"/org/evaluate/detail/info"},
				          		{id:6, parentId:5,name:"比赛晋级", menu:0,url:"/org/evaluate/detail/jinji/info"},
				          		{id:7, parentId:5,name:"比赛报名", menu:0,url:"/org/evaluate/detail/baoming/info"},
				          		{id:8, parentId:5,name:"比赛报名", menu:0,url:"/org/evaluate/detail/caiwu/info"},
				{id:9, parentId:0,name:"账户管理", menu:1,url:""},
					{id:10, parentId:9,name:"收款设置", menu:1,url:"/org/acc/conf"},
					{id:11, parentId:9,name:"修改密码", menu:1,url:"/org/acc/pwd"},
					
					{id:18, parentId:0,name:"新闻公告",url:""},
					   {id:19, parentId:18,name:"文章",url:"/v2/shop/article"},
					   {id:110, parentId:18,name:"公告",url:"/v2/shop/notice"},
					   {id:111, parentId:18,name:"照片墙",url:"/v2/shop/zpq"},
					   {id:112, parentId:18,name:"外链",url:"/v2/shop/new"},
					   {id:12, parentId:9,name:"机构详情", menu:1,url:"/org/acc/orgdetails"},
					   //{id:91, parentId:9,name:"子账号",url:"/v2/acc/son"},
				    //{id:13, parentId:9,name:"品牌机构", menu:1,url:"/acc/brand"},
				    //{id:14, parentId:9,name:"财务管理", menu:1,url:"/acc/finance"},
	           ];
	}

			var loadUp = function(ups, id){
				var us = [];
				$.each(ups, function(i,v){
					if(v.parentId==id){
						v.url = ''+v.url;
						if(v.url==location.pathname){
							v.active = 'active';
							v.open = 'open';
						}
						v.list = loadUp(ups,v.id);
						if(v.url == '/org'){
							v.url="javascript:loadSonMenu("+v.id+", "+v.parentId+", true)";
						}
						if(v.list.length > 0){
							$.each(v.list, function(i2,v2){
								if(v2.active == 'active'){
									loadSonMenu(v.id, v.parentId);
									v.active = 'active';
									v.open = 'open';
								}
							});
						}
						us.push(v);
						}
				});
				return us;
			}
			
			var loadSonMenu = function(id, parentId, flag){
				if(parentId == 0){
					return;
				}
				var sonMenu=[];
				$.each(ups, function(i,v){
					if(v.parentId==id){
						sonMenu.push(v);							
					}
				});
				if(flag){
					location.href=sonMenu[0].url;
				}
				$("#sonMenu").loadData({sonMenu:sonMenu});
			}
			
			$(function(){
				var us = loadUp(ups, 0);
				$("#subList").loadData({ups:us}, function(){
/* 		        	var list = $('.sidebar .sub-nav:eq(2) .sub-list>li')
		        	$.each([0,2,3], function(i, o ){
		        	  list.eq(o).hide()
		        	}) */
				});
	
				
				$(".sidebar .sub-nav a").click(function(){
					$(this).next().slideToggle(300);
				});
			});
			
	
	</script>

	<div class="sidebar">
       	<div class="side open">
        	<div class="side-fold">
        		<span class="l"></span>
	            <span class="l"></span>
	            <span class="l"></span>
        	</div>
        </div>
        <script type="text/template" id="subList">
		#for(up:ups)#
        <ul class="sub-nav">
			<li>
				<a class="#{up.active}#" href="#{up.url}#">
					<i class="side-sys side-#{up.id}#"></i>
					<span class="text">#{up.name}#</span>
					<em class="arrow"></em>
				</a>
				<ul class="sub-list open">
					#for(u2:up.list)#
					<li>
						<a class="#{u2.active}#" href="#{u2.url}#">
							<span class="text">#{u2.name}#</span>
						</a>
					</li>
					#endfor#
				</ul>
			</li>
		</ul>
		#endfor#
	</script>
	</div>

             <!--    <ul class="sub-list open">默认打开
                <ul class="sub-list #{up.open}#">默认关闭 -->

</div>